/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */

/** Autor: Reynaldo Bernard de Dios de la Cruz.
 * Fecha: 1 de Septiembre del 2014
 * Objetivo: Elaborar una clase que tome el tiempo de la computadora.
 */
package Utilerias;

import java.util.Calendar;

public class Cronometro
{
   public long tiempo_Inicio, tiempo_fin;
   public Calendar cronometro = Calendar.getInstance();
   public int hora, minutos, segundos;
   public String mensaje;
   
   public Cronometro(String pMensaje)
   {
      mensaje = pMensaje;
   }
   
   public void imprimirHora()
   {
      hora =cronometro.get(Calendar.HOUR_OF_DAY);
      minutos = cronometro.get(Calendar.MINUTE);
      segundos = cronometro.get(Calendar.SECOND);
      
      System.out.println("--------------------[ "+ mensaje + "] \n" +
                       "                        "+ hora + ":" + minutos + ":" + segundos);
   }
   
   public int getHora()
   {
      return hora = cronometro.get(Calendar.HOUR_OF_DAY);
   }
   
   public int getMinutos()
   {
      return minutos = cronometro.get(Calendar.MINUTE);
   }
   
   public int getSegundos()
   {
      return segundos = cronometro.get(Calendar.SECOND);
   }
   
   public long getInicio()
   {
      return tiempo_Inicio = System.currentTimeMillis();
   }
   
   public long getFinal()
   {
      return tiempo_fin = System.currentTimeMillis();
   }
   
}
